<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">
	<ui:composition template="./main.xhtml">
		<ui:define name="content">
	    <h:outputScript name="calendar.js" library="javascript" target="head"/>
			<f:event listener="#{searchController.initialize}" type="preRenderView"></f:event>
			<br/>
			<p:messages autoUpdate="true" closable="true" />
			<h:form>
			<p:panelGrid columns="2" columnClasses="ui-widget-header, left">
				<f:facet name="header">
					検索条件を入力してください。<p:commandButton value="開始検索" update="resultList" action="#{searchController.search}" styleClass="button_small" />
    			</f:facet>
    			<h:outputText value="利用者："/>
    			<p:selectOneMenu value="#{searchConversation.selectStaff}" converter="#{staffConverter}" filter="true" filterMatchMode="startsWith">
					<f:selectItems value="#{sessionBean.staffMenus}"/>
				</p:selectOneMenu>
				<h:outputText value="開始日："/>
				<p:calendar value="#{searchConversation.startDate}" pattern="yyyy/MM/dd" mode="popup" showOn="button" locale="jp" converterMessage="日付ではありません。"/>
				<h:outputText value="終了日："/>
				<p:calendar value="#{searchConversation.endDate}" pattern="yyyy/MM/dd" mode="popup" showOn="button" locale="jp" converterMessage="日付ではありません。"/>
			</p:panelGrid>
			<br/><br/>
			<p:dataTable id="resultList" value="#{searchConversation.dailyList}" var="record" emptyMessage="検索してください" styleClass="noWrap">
				<p:column headerText="日付">
					<h:outputText value="#{record.daily.date}" styleClass="red" rendered="#{record.holiday}">
						<f:convertDateTime pattern="MM月dd日（E）" locale="ja_JP"/>
					</h:outputText>
					<h:outputText value="#{record.daily.date}" rendered="#{record.holiday eq false}">
						<f:convertDateTime pattern="MM月dd日（E）" locale="ja_JP"/>
					</h:outputText>
				</p:column>
				<p:column headerText="作業時間">
					<h:outputText value="#{record.workTime}"/>
				</p:column>
				<p:column headerText="内容" styleClass="pre left">
					<h:outputText value="#{record.daily.content}"/>
				</p:column>
			</p:dataTable>
			</h:form>
		</ui:define>
	</ui:composition>
</html>